<?php
/**
 * URL 测试脚本
 */

// 要测试的URL列表
$urls = [
    'http://127.0.0.1/index',
    'http://127.0.0.1/achievements',
    'http://127.0.0.1/age-3-4',
    'http://127.0.0.1/age-5-6',
    'http://127.0.0.1/age-7-8',
    'http://127.0.0.1/register',
    'http://127.0.0.1/membership',
    'http://127.0.0.1/login'
];

echo "开始测试URLs...\n\n";

foreach ($urls as $url) {
    echo "测试 $url ... ";
    
    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_HEADER, true);
    curl_setopt($ch, CURLOPT_NOBODY, true);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    curl_setopt($ch, CURLOPT_TIMEOUT, 5);
    
    curl_exec($ch);
    $status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    curl_close($ch);
    
    if ($status_code >= 200 && $status_code < 300) {
        echo "成功! (状态码: $status_code)\n";
    } else {
        echo "失败! (状态码: $status_code)\n";
    }
}

echo "\n测试完成。\n"; 